using System;
using NUnit.Framework;
using IronMis2.Models;

namespace IronMis2.Tests.Models
{
    [TestFixture]
    public class IncomeTestCase:AbstractModelTestCase
    {
        private Employee employee;
        private Income income;
        [SetUp]
        public override void Init()
        {
            base.Init();

            employee = new Employee();
            employee.UserId = Guid.NewGuid().ToString();
            employee.Name = "rader";
            employee.Password = "rader";
            employee.Department = Department.FindFirst();

            income = new Income();
            income.Employee = employee;
            income.IncomeAccount = "1432121214";
            income.IncomeID = "1231412";
//            income.IncomeDate = DateTime.Now;
            
            employee.Save();
            income.Save();
            Flush();
        }
        [Test]
        public void CanSaveWithoutDateTime()
        {
            Income dbincome = Income.Find(income.Id);
            Assert.IsNotNull(dbincome);
        }
        [Test]
        public void IsTheEmployeeNull()
        {
            Income dbincome = Income.Find(income.Id);
            Assert.IsNotNull(dbincome.Employee);
        }

        [TearDown]
        public override void Terminate()
        {
            employee.Delete();
            Flush();
            base.Terminate();

        }
    }
}